﻿

namespace ciji.Core
{
    public class UserHelper
    {
        public static string GetUserId()
        {
            var value = App.User?.FindFirst(ClaimConst.UserId);
            return value.Value;
        }
        public static string GetUserName()
        {
            var value = App.User?.FindFirst(ClaimConst.Name);
            if (value == null)
            {
                return "";
            }
            return value.Value;
        }
        public static int GetAuth()
        {
            var value = App.User?.FindFirst(ClaimConst.Auth);
            return int.Parse(value.Value);
        }
        public static string GetAreaId()
        {
            var value = App.User?.FindFirst(ClaimConst.UserAreaId);
            if (value == null)
            {
                return "";
            }
            return  value.Value;
        }
        public static long GetComponyId()
        {
            var value = App.User?.FindFirst(ClaimConst.UserCompnayId);
            if (value == null)
            {
                return 0;
            }
            return long.Parse(value.Value);
        }

        public static long GetTokenTime()
        {
            var value = App.User?.FindFirst(ClaimConst.Timestamp);
            if (value == null)
            {
                return 0;
            }
            return long.Parse(value.Value);
        }

    }
}
